extends KinematicBody2D

export (int) var speed = 100

export (int) var run_speed = 100
export (int) var jump_speed = -400
export (int) var gravity = 1200
#var jumping = false
var velocity = Vector2()
var jumpspeed = 500

func get_input():
	velocity.x = 0
	var right = Input.is_action_pressed('ui_right')
	var left = Input.is_action_pressed('ui_left')
	var jump = Input.is_action_just_pressed('ui_up')

	if jump:
#		jumping = true
		velocity.y += jump_speed
	if right:
		velocity.x += run_speed
	if left:
		velocity.x -= run_speed

func _physics_process(delta):
	get_input()
	velocity.y += gravity * delta
#	if jumping :
#		jumping = false
	velocity = move_and_slide(velocity, Vector2(0, -1))
